<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of Configuration
 *
 * @author MinhNguyen
 */

class Mail {
    //put your code here
    public $to;
    public $subject;
    public $message;
    public $from;
    public $headers;
    
    public function __construct() {
        //allocate your stuff
    }
    
    /**
     * 
     * @param type $name
     * @return type
     */
    public function __get($name) {
        return $this->$name;
    }
    
    /**
     * 
     * @param type $name
     * @param type $value
     */
    public function __set($name, $value) {
        $this->$name = $value;
    }
    
    /**
     * 
     * @param type $to
     * @param type $subject
     * @param type $message
     * @param type $from
     * @return \self
     */
    public static function withData($to, $subject, $message, $from) {
        $instance = new self();
        $instance->to = $to;
        $instance->subject = $subject;
        $instance->message = $message;
        $instance->from = $from;
        $instance->headers = "From: '$from'";
        return $instance;
    }
}    
?>
